//
//  PCUserGameModel.m
//  PhotoCircle
//
//  Created by GL on 15/12/18.
//  Copyright © 2015年 wujungao. All rights reserved.
//

#import "PCUserGameModel.h"

#define KEY_Game_UUID           @"uuid"
#define KEY_Game_Date           @"created_at"
#define KEY_Game_CommentCount   @"comments_count"
#define KEY_Game_Description    @"description"
#define KEY_Game_Image          @"image"
#define KEY_Game_RealImage      @"real_image"
#define KEY_Game_Scode          @"scode"
#define KEY_Game_Title          @"title"
#define KEY_Game_TotalFee       @"total_fee"
#define KEY_Game_AuthorName     @"user_name"
#define KEY_Game_VotesCount     @"votes_count"

#define KEY_Game_State          @"state"
#define KEY_State_CN            @"cn"
#define KEY_State_VAL           @"val"

#define KEY_Game_ChooseState    @"choose_state"

@interface PCUserGameModel ()

@end

@implementation PCUserGameModel

- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super initWithDictionary:dict];
    if (self) {
        
        if (dict[KEY_Game_UUID]!=[NSNull null]) {
            _gUUID = dict[KEY_Game_UUID];
        }
        
        if (dict[KEY_Game_Date]!=[NSNull null]) {
            _gDate = dict[KEY_Game_Date];
        }
        
        if (dict[KEY_Game_CommentCount]!=[NSNull null]) {
            
            NSNumber *albumNumber = (NSNumber*)dict[KEY_Game_CommentCount];
            NSString *aCount = [albumNumber stringValue];
            _gCommentCount = aCount;
        }

        if (dict[KEY_Game_Description]!=[NSNull null]) {
            _gInfo = dict[KEY_Game_Description];
        }

        if (dict[KEY_Game_Image]!=[NSNull null]) {
            _gImgUrl = dict[KEY_Game_Image];
        }
        
        if (dict[KEY_Game_RealImage]!=[NSNull null]) {
            _gRealImgUrl = dict[KEY_Game_RealImage];
        }
        if (dict[KEY_Game_Scode]!=[NSNull null]) {
            _gScode = dict[KEY_Game_Scode];
        }
        if (dict[KEY_Game_Title]!=[NSNull null]) {
            _gTitle = dict[KEY_Game_Title];
        }
        if (dict[KEY_Game_TotalFee]!=[NSNull null]) {
            
            NSNumber *albumNumber = (NSNumber*)dict[KEY_Game_TotalFee];
            NSString *aCount = [albumNumber stringValue];
            _gTotalFee = aCount;
        }
        if (dict[KEY_Game_AuthorName]!=[NSNull null]) {
            _gAuthorName = dict[KEY_Game_AuthorName];
        }
        if (dict[KEY_Game_VotesCount]!=[NSNull null]) {
            
            NSNumber *albumNumber = (NSNumber*)dict[KEY_Game_VotesCount];
            NSString *aCount = [albumNumber stringValue];
            _gVotesCount = aCount;
        }
        
        // 主状态
        if (dict[KEY_Game_State]!=[NSNull null]) {
            NSDictionary *stateDic = dict[KEY_Game_State];
            if (stateDic[KEY_State_CN]!=[NSNull null]) {
                _gMarkGame = stateDic[KEY_State_CN];
            }
            if (stateDic[KEY_State_VAL]!=[NSNull null]) {
                _gState = stateDic[KEY_State_VAL];
            }
            //_gState = dict[KEY_Game_State];
        }

        // 参赛作品当前状态
        if (dict[KEY_Game_ChooseState]!=[NSNull null]) {
            NSDictionary *stateDic = dict[KEY_Game_ChooseState];
            if (stateDic[KEY_State_CN]!=[NSNull null]) {
                _gChooseMark = stateDic[KEY_State_CN];
            }
            if (stateDic[KEY_State_VAL]!=[NSNull null]) {
                _gChooseState = stateDic[KEY_State_VAL];
            }
            //_gState = dict[KEY_Game_State];
        }

    }
    return self;
}


@end
